home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_stdio__slot.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  533 b   |  31 lines

  1. /*                _ s l o t
  2.  *
  3.  * Locate the stream slot with the specified FILE pointer. If the
  4.  * pointer is NULL, this routine will locate the first free slot.
  5.  * The function will return a pointer to the slot, otherwise
  6.  * NULL.
  7.  *
  8.  * Patchlevel 1.0
  9.  *
  10.  * Edit History:
  11.  */
  12.  
  13. #include "stdiolib.h"
  14.  
  15. /*LINTLIBRARY*/
  16.  
  17. FILE **_slot(fp)
  18.  
  19. FILE *fp;                /* stream required */
  20.  
  21. {
  22.   FILE **sp;                /* slot in table */
  23.   int n;                /* number of slots */
  24.  
  25.   for (n = _NFILE, sp = _iop; *sp != fp; sp++)
  26.     if (--n < 0)
  27.       return NULL;
  28.  
  29.   return sp;
  30. }
  31.